<?php
		/* Modify the field dni into the customer table */
		$sql = mysql_query ('ALTER TABLE `'._DB_PREFIX_.'customer` CHANGE `dni` `dni` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL');
		
		/* Modify the dni-modificated files */
			//patch dni-modificated authentication.tpl to do dni-no mandatory
			$src1 = _PS_THEME_DIR_.'/authentication.tpl';
			$old1a='<p class="required text">
			<label for="customer_dni">{l s=\'Tax Identification Number\'}</label>
			<input onkeyup="$(\'#dni\').val(this.value);" type="text" class="text" id="customer_dni" name="customer_dni" value="{if isset($smarty.post.customer_dni)}{$smarty.post.customer_dni}{/if}" />
			<sup>*</sup>
            <span class="form_info">{l s=\'Passport,...\'}</span>
			</p>';
			$new1a='<p class="text">
			<label for="customer_dni">{l s=\'Tax Identification Number\'}</label>
			<input onkeyup="$(\'#dni\').val(this.value);" type="text" class="text" id="customer_dni" name="customer_dni" value="{if isset($smarty.post.customer_dni)}{$smarty.post.customer_dni}{/if}" />
			<span class="form_info">{l s=\'Passport,...\'}</span>
			</p>';
			$old1b='<p class="required text">
				<label for="dni">{l s=\'Tax Identification Number\'}</label>
				<input type="text" class="text" id="dni" name="dni" value="{if isset($smarty.post.dni)}{$smarty.post.dni}{/if}" />
				<sup>*</sup>
			</p>';
			$new1b='<p class="text">
				<label for="dni">{l s=\'Tax Identification Number\'}</label>
				<input type="text" class="text" id="dni" name="dni" value="{if isset($smarty.post.dni)}{$smarty.post.dni}{/if}" />
			</p>';
			$openfile1 = file_get_contents($src1);
			$search1 = array($old1a, $old1b);
			$replace1 = array($new1a, $new1b);
			$patch1 = str_replace ($search1, $replace1, $openfile1);
			$openfile1 = file_put_contents($src1, $patch1);

			
			//patch dni-modificated identity.tpl to do dni-no mandatory
			$src3 = _PS_THEME_DIR_.'/identity.tpl';
			$old3a='<p class="required text">
				<label for="dni">{l s=\'Tax Identification Number\'}<sup>*</sup></label>
				<input type="text" name="dni" id="dni" value="{$smarty.post.dni}" />
			</p>';
			$new3a='<p class="text">
				<label for="dni">{l s=\'Tax Identification Number\'}</label>
				<input type="text" name="dni" id="dni" value="{$smarty.post.dni}" />
			</p>';
			$openfile3 = file_get_contents($src3);
			$search3 = array($old3a);
			$replace3 = array($new3a);
			$patch3 = str_replace ($search3, $replace3, $openfile3);
			$openfile3 = file_put_contents($src3, $patch3);
			
			//patch dni-modificated AdminCustomers.php to do dni-no mandatory
			$src4 = PS_ADMIN_DIR.'/tabs/AdminCustomers.php';
			$old4a='\'dni\'), ENT_COMPAT, \'UTF-8\').\'" /> <sup>*</sup>
					<span';
			$new4a='\'dni\'), ENT_COMPAT, \'UTF-8\').\'" />
					<span';
			$openfile4 = file_get_contents($src4);
			$search4 = array($old4a);
			$replace4 = array($new4a);
			$patch4 = str_replace ($search4, $replace4, $openfile4);
			$openfile4 = file_put_contents($src4, $patch4);
			
			//patch dni-modificated Customer.php to do dni-no mandatory
			$src5 = _PS_CLASS_DIR_.'/Customer.php';
			$old5a='firstname\', \'email\', \'dni\');';
			$new5a='firstname\', \'email\');';
			$openfile5 = file_get_contents($src5);
			$search5 = array($old5a);
			$replace5 = array($new5a);
			$patch5 = str_replace ($search5, $replace5, $openfile5);
			$openfile5 = file_put_contents($src5, $patch5);

?>